﻿using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;

namespace COSIX
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            Console.WriteLine("Initializing COSIX 2013...");
            Global.Init();
        }
        bool devRelease = true;
        protected override void Run()
        {
            if (devRelease)
            {
                Global.CurrentUser = "root";
                Global.CurrentDirectory = "/home/root";
            }

        cmdp:
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write(Global.CurrentUser + " ");
            //Console.Write("root ");
            Console.ForegroundColor = ConsoleColor.Red;
            //Console.Write("~/home/root/ ");
            Console.Write("~");
            Console.Write(Global.CurrentDirectory);
            Console.Write(" ");
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.Write("# ");
            Console.ForegroundColor = ConsoleColor.White;
            var cinput = Console.ReadLine();
            var coutput = cinput.SplitAtFirstSpace()[1];
            Global.CmdMgr.Run(cinput, coutput);
            goto cmdp;
        }
    }
}
